home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Plus
/
Graphics Plus.iso
/
msdos
/
raytrace
/
pov
/
gen
/
prepov05
/
prepov05.rea
< prev
Wrap
Text File
|
1994-10-03
|
6KB
|
259 lines
Short: preprocessor for POV 1.0
Type: gen/pc
Author:
Uploader:
================================================================ PREPOV 0.5
Pre-Processor for PoVRay 1.0 RMB Compuserve 73050,261
================================================================ Feb /93
--- F R E E W A R E --- USE IT !!!
- Prepov is a "preprocessor", that means it need a Input File (ascii) and the
Output is another ascii file processed.
- Usage : PREPOV05 Input Output
where Input is the file to process and Output is the file processed,
you have to enter the complete name of the file WITH EXETENSION.
The program override the Output file, if it exist, so take care.
- Ej. PREPOV05 example.pre example.pov
============================== SYNTAXIS =====================================
Constants.
-----------------------------------------------------------------------------
Prepov replaces in the input file all the ocurrences between "[" and "]",
with the value of the formula evaluated.
Ej.
Input
object {
sphere {< [1+1] [ 4/2] [ (2.5+1.5)/2 ]> [8/4] > }
}
Output
object {
sphere {< 2.0 2.0 2.0> 2.0 > }
}
Var's
-----------------------------------------------------------------------------
With Preprov you can define var's and then use them in your file.
The var's name are 00 to 99 and you define them with the "#" character
and use them with the "@" character.
Ej.
Input
#01 = 1.5
#23 = 2.5
object {
sphere {< [1+1] 2 [ (@23+@01)/2 ]> [8/4] > }
}
Output
// #01 = 1.5
// #23 = 2.5
object {
sphere {< 2.0 2 2.0> 2.0 > }
}
You can use the var's in any order, but TAKE CARE to define only one var
per line and nothing else! in that line. You can use the var's in where you
want any number of times. Is posible to re-define the var's where you want.
If you use a var with no definition it has the value 0.0 (cero).
REMEMBER to put the formula between "[ ]"
Ej.
// This definition are correct !
#10 =5.23
#20 = 10.5
#00=8.3
// This definitions are INCORRECT !
#1 = 5.23
#01 = 8.23 // Don't put comments in the same line!
#01 = 10 #02 = 20
In the first case don't use #1 use #01, in the two others there is something
else in the line.
Ej.
Input
// This is a CORRECT EXAMPLE using var's.
#01 = 10
#02 = 0.500
#03 = 0.75
#90 = 0.4
object {
sphere { <[@01] [@01/2] 0> [@01/5] }
texture
{
color red [@02] green [@02/2] blue 0 alpha [@03]
ambient [@90]
}
}
#01 = 20
#90 = 0.6
object {
sphere { <[@01] [@01/2] 0> [@01/5] }
texture
{
color red [@02] green [@02/2] blue 0 alpha [@03]
ambient [@90]
}
}
Output
// This is a CORRECT EXAMPLE using var's.
//#01 = 10
//#02 = 0.500
//#03 = 0.75
//#90 = 0.4
object {
sphere { <10.0000 5.0000 0> 2.0000 }
texture
{
color red 0.5000 green 0.2500 blue 0 alpha 0.7500
ambient 0.4000
}
}
//#01 = 20
//#90 = 0.6
object {
sphere { <20.0000 10.0000 0> 4.0000 }
texture
{
color red 0.5000 green 0.2500 blue 0 alpha 0.7500
ambient 0.6000
}
}
Value format
-----------------------------------------------------------------------------
Prepov use the format (Pascal) d1:d2 when in prints a value, where d1 is
the number of total digits (including the point) and d2 is the number of
digits for the fractional part.
Ej
12.12:6:3 ==> 12.120
0.1 :6:3 ==> 0.100
The default value of d1 and d2 is 4, but you can change where you want
defining two special var's #d1 and #d2.
Ej.
Input
sphere {<0 0 [1.18]> 1>}
#d1 = 6
#d2 = 1
sphere {<0 0 [1.18]> 1>}
Ouput
sphere {<0 0 1.1800> 1>}
#d1 = 6
#d2 = 1
sphere {<0 0 1.2> 1>}
Formula format
-----------------------------------------------------------------------------
You can use any format number like .1 0.1 1E-01 are all equiv.
and any of these operators : + - * / ^
Example [{ (1.0+1)^3/8 } + { (3*3/9.0) }] = 2 // You can use { and }
You can use any of this functions upercase or lowercase:
PI - ABS - SQRT - SQR - LN - LOG - EXP - FACT
SINH - COSH - TANH - SECH - CSCH - COTH
SIN - COS - TAN - SEC - CSC - COT - ASIN - ACOS - ATAN
The trigonometics functions (Sin,Cos etc..) use radians angles (Pi/2 == 90)
Examples
[Pi*1.0] = 3.14159
[FACT(3)] = 6.00000 // Factorial of 3 = 3! (Can't use real numbers)
[Sin(Pi/4)]= 0.7071 // Pi/4 in radians == 45 degrees
[{ln(Sin(Pi/4))} + log(sqrt(18.34))] = 0.2851
Errors
-----------------------------------------------------------------------------
The only errors the program detects are formula errors, when they happen
the program stop with a message printing the formula, the location and the
type of error.
Ej
Input
#01 = 3
sphere { <0 0 [Sin(@01*2)+1+*2]> 1}
Ouput (screen)
Sin(3.0000*2)+1+*2
^ Error #2 In Line xxxx
Error Types
1: Illegal character
2: Incorrect syntax
3: Illegal or missing parenthese
4: Incorrect real format
5: Illegal function
6: Result is undefined
7: Result is too large
8: Result is complex
9: Division by zero
Others
-----------------------------------------------------------------------------
I supouse this is a very useful program, if you think it needs something else
like loops or if then estructure, please let me know at compuserve 73050,261
or UUPC @postmaster.cement.edu.ar
Sorry for my writing I'am not so good in english.
Thank's to all the POV-Team